<?php
namespace app\shangjia\controller;
use think\Db;
use think\Request;
class Indert {
    //显示订单
    public function indert_show()
    {
        $sql="select * from man_order INNER JOIN man_merchants on man_order.m_id = man_merchants.m_id INNER JOIN man_user on man_order.u_id = man_user.u_id";
        $data=Db::query($sql);
        return view('indert_show',['data'=>$data]);
    }
    //显示订单详情
    public function indert_xq(){
        $sql="select * from man_order_product INNER JOIN man_goods on man_order_product.g_id = man_goods.g_id INNER JOIN man_order on man_order_product.o_id = man_order.o_id INNER JOIN man_guige on man_order_product.gui_id = man_guige.gui_id";
        $data=Db::query($sql);
        return view("indert_xq",['data'=>$data]);
    }

    //显示用户
    public function indert_me(){
        $sql  ="select * from man_user";
        $data =Db::query($sql);
        return view("indert_me",['data'=>$data]);
    }
    //即点即改支付状态
   public function indert_upd(){
        $id    = Request::instance()->post('o_id');
        $statc = Request::instance()->post('o_statc');
        $sql   ="update man_order set o_statc='$statc' where o_id=$id";
        $res   = Db::execute($sql);
        if($res){
            return 1;
        }else{
            return 0;
        }
    }
    //即点即改退款状态
    public function indert_tk(){
        $id    = Request::instance()->post('o_id');
        $back  = Request::instance()->post('o_back');
        $sql   ="update man_order set o_back='$back' where o_id=$id";
        $res   = Db::execute($sql);
        if($res){
            return 1;
        }else{
            return 0;
        }
    }
}